package com.pzl.library.base;

import java.util.ArrayList;

/**
 * Created by zl.peng on 2016-03-25.
 */
public class Root extends Node {
    private ArrayList<Node> nodeList;

    public Root() {
        this.level = 0;
    }

    @Override
    public void setLevel(int level) {
        this.level = 0;
    }

    @Override
    public void setParent(Node parent) {
        this.parent = null;
    }

    @Override
    public ArrayList<Node> treeToList() {
        ArrayList<Node> nodes = super.treeToList();
        nodes.remove(this);
        nodeList = nodes;
        return nodes;
    }

    /**
     * addchild;removechild;clear;展开收缩时调用
     */
    public void update() {
        treeToList();
    }

    public void init() {
        treeToList();
    }

    public ArrayList<Node> getNodeList() {
        return nodeList;
    }
}
